package com.youlai.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.system.model.entity.SysCheckItem;
import com.youlai.system.model.query.CheckItemPageQuery;
import com.youlai.system.service.SysCheckItemService;
import com.youlai.system.mapper.SysCheckItemMapper;
import org.springframework.stereotype.Service;

/**
* @author 86177
* @description 针对表【sys_check_item(检查费用表)】的数据库操作Service实现
* @createDate 2024-08-23 11:47:04
*/
@Service
public class SysCheckItemServiceImpl extends ServiceImpl<SysCheckItemMapper, SysCheckItem>
    implements SysCheckItemService{

    @Override
    public IPage<SysCheckItem> listPagedCheckItems(CheckItemPageQuery queryParams) {
        IPage<SysCheckItem> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
        QueryWrapper<SysCheckItem> wrapper = new QueryWrapper<>();
        if (queryParams.getCheckItemName() != null) {
            wrapper.like("check_item_name", queryParams.getCheckItemName());
        }
        if (queryParams.getKeywords() != null){
            wrapper.like("keywords", queryParams.getKeywords());
        }
        if (queryParams.getTypeId() != null){
            wrapper.eq("type_id", queryParams.getTypeId());
        }
        if ( queryParams.getStatus() != null){
            wrapper.eq("status", queryParams.getStatus());
        }
        return this.page(page, wrapper);
    }
}




